/**
 * Author shuqi
 * Rev
 * Date: 2021-08-18 22:17
 * <p>
 * Copyright (C) 2021 Seeyon, Inc. All rights reserved.
 * <p>
 * This software is the proprietary information of Seeyon, Inc.
 * Use is subject to license terms.
 * @company seeyon.com
 * @since V5 V7.1
 * @author shuqi
 */
package com.lagou.handler;

import com.lagou.Request;
import com.lagou.Response;
import com.lagou.config.ServerConfig;

import java.util.Map;

/**
 * @description
 * @date 2021-08-18 22:17
 * @author xiaol
 */
public class HostHandler extends AbstractHandler{


	@Override
	public void handleRequest(Request request, Response response) {
		String context = request.getContext();
		ServerConfig.ServiceConfig serviceConfig = ServerConfig.getServiceConfig();
		Map<String, ServerConfig.Context> stringContextMap = serviceConfig.getConfig().get(request.getHost());
		AbstractHandler nextHandler = this.getNextHandler();
		//匹配context交由contextHandler处理
		if(stringContextMap.containsKey(context) && nextHandler != null){
			nextHandler.handleRequest(request,response);
		}
	}
}
